package net.chrisrichardson.cloudtools.maven.plugins;

import java.io.File;

import net.chrisrichardson.ec2deployer.cluster.ClusterManager;
import net.chrisrichardson.ec2deployer.cluster.SimpleCluster;

import org.apache.maven.plugin.MojoExecutionException;

/**
 * Goal for restoring the database
 * @goal dbrecreate
 * @author cer
 *
 */
public class DbRecreateMojo extends AbstractClusterMojo {

  /**
   * @parameter expression="${cloudtools.sql.script}
   */
  protected File sqlScript;

  @Override
  protected void executeWithCluster(ClusterManager manager, SimpleCluster cluster) throws MojoExecutionException {
    verifyFileExists(sqlScript);
    cluster.dbRecreate(sqlScript);
  }

}
